package ai;

import model.Slot;

/**
 * Classe che rappresenta la posizione e il colore del giocatore che porta una
 * "minaccia"
 */
public class Threat implements Comparable<Threat>{

	private int row, col;
	private Slot slot;
	private boolean isVertical;
	private boolean isPlayable;


	public Threat(int row, int col, Slot slot, boolean isPlayable) {
		this.row = row;
		this.col = col;
		this.slot = slot;
		this.isVertical = false;
		this.isPlayable = isPlayable;
	}

	public boolean isPlayable() {
		return isPlayable;
	}

	public void setPlayable(boolean isPlayable) {
		this.isPlayable = isPlayable;
	}

	public int getRow() {
		return row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	public int getCol() {
		return col;
	}

	public void setCol(int col) {
		this.col = col;
	}

	public Slot getSlot() {
		return slot;
	}

	public void setSlot(Slot slot) {
		this.slot = slot;
	}

	public boolean isOdd(int boardRows) {
		boolean res = row % 2 == 0;
		if (boardRows % 2 == 0)
			return !res;
		else
			return res;
	}

	@Override
	public int compareTo(Threat o) {
		if(this.row>o.row)
			return -1;
		else if(this.row<o.row)
			return 1;
		else
			return 0;
	}

	public boolean isVertical() {
		return isVertical;
	}

	public void setVertical(boolean isVertical) {
		this.isVertical = isVertical;
	}
}
